namespace PTUDW_CNTN2010_F_CDT.Migrations
{
    using PTUDW_CNTN2010_F_CDT.Models;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<PTUDW_CNTN2010_F_CDT.Models.EcommerceDBContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = true;
        }

        protected override void Seed(PTUDW_CNTN2010_F_CDT.Models.EcommerceDBContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //

            /// Add languages
            /// 
            context.Languages.AddOrUpdate(l => new { l.Culture, l.Name },
                new Language
                {
                    Culture = "en-US",
                    Name = "United States"
                },
                new Language
                {
                    Culture = "vi-VN",
                    Name = "Vietnam"
                });


            /// Add another database
            /// =====================
            /// 
            context.Categories.AddOrUpdate(l => new { l.CategoryId, l.CategoryName },
                new Category
                {
                    CategoryId = 1,
                    CategoryName = "Dien Thoai",
                },
                new Category
                {
                    CategoryId = 2,
                    CategoryName = "Laptop",
                },
                new Category
                {
                    CategoryId = 3,
                    CategoryName = "May chup anh",
                },
                new Category
                {
                    CategoryId = 4,
                    CategoryName = "May nghe nhac",
                }
                );

            /// Add Gender Database
            /// 
            context.Provinces.AddOrUpdate(l => new { l.ProvinceId },
                new Province
                {
                    ProvinceName = "Binh Dinh"
                },
                new Province
                {
                    ProvinceName = "Quang Ngai"
                });

            context.SkypeChats.AddOrUpdate(l => new { l.NickName },
                new SkypeChat
                {
                    NickName = "ngcaothu"
                },
                new SkypeChat
                {
                    NickName = "thanhthaokq92"
                });
        }
    }
}
